package fr.umlv.m2.jee.pmlv.persistence.cursus;

import java.io.Serializable;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;


/**
 * Represents a university cursus. It's a entity. 
 * @author jenseric
 *
 */
@SuppressWarnings("serial")
@Entity
@Table(name="Cursus")
public class Cursus implements Serializable {

	/**
	 * The id of the cursus in the data base.
	 */
	@Id
	@GeneratedValue
	@Column(name = "cursus_id")
	private long id;

	/**
	 * The name of the cursus.
	 */
	@Column(name= "cursus_name")
	private String name;

	/**
	 * The descriptoin of the cursus.
	 */
	@Column(name= "cursus_description")
	private String description;

	/**
	 * Set of {@link Specialty} which are associated by the Cursus.
	 */
	@OneToMany(mappedBy="cursus", cascade=CascadeType.ALL, fetch=FetchType.EAGER)
	private Set<Specialty> specialties;

	/**
	 * Returns the id of the cursus.
	 * @return the id of the cursus.
	 */
	public long getId() {
		return id;
	}

	/**
	 * Sets the id of the cursus.
	 * @param id the short that is to the id of the cursus. 
	 */
	public void setId(long id) {
		this.id = id;
	}

	/**
	 * Gets the name of the cursus.
	 * @return the name of the cursus.
	 */
	public String getName() {
		return name;
	}

	/**
	 * Sets the name of the cursus.
	 * @param name the name that is to be name of the cursus.
	 */
	public void setName(String name) {
		this.name = name;
	}

	/**
	 * Returns a description of the cursus.
	 * @return a description of the cursus.
	 */
	public String getDescription() {
		return description;
	}

	/**
	 * Sets the description of the cursus.
	 * @param description the string that is to be the description
	 * of the cursus.
	 * 
	 */
	public void setDescription(String description) {
		this.description = description;
	}


	/**
	 * Sets the list of Specialty of the cursus.
	 * @param specialties the list that is to bet the set of {@link Specialty} of the
	 * 		  core
	 */
	public void setSpecialties(Set<Specialty> specialties) {
		this.specialties = specialties;
	}

	/**
	 * Returns the list of Specialty of the cursus.
	 * @return the list of {@link Specialty} of the cursus.
	 */
	public Set<Specialty> getSpecialties() {
		return specialties;
	}
}
